package com.hb.trans.mvp.ui.activity


import android.os.Bundle
import android.view.MenuItem
import com.alibaba.android.arouter.facade.annotation.Route
import com.basiclib.base.BaseActivity
import com.hb.trans.R
import com.hb.trans.bean.AboutUs
import com.hb.trans.global.ACTIVITY_HOME_ABOUT_US
import com.hb.trans.mvp.contract.AboutUsContract
import com.hb.trans.mvp.presenter.AboutUsPresenter
import dagger.android.AndroidInjection
import kotlinx.android.synthetic.main.activity_about_us.*
import javax.inject.Inject


@Route(path = ACTIVITY_HOME_ABOUT_US)
class AboutUsActivity : BaseActivity(), AboutUsContract.View {


    @Inject
    lateinit var mPresenter: AboutUsPresenter

    override fun getContentViewResId(): Int = R.layout.activity_about_us

    override fun onActivityInject() {
        AndroidInjection.inject(this)
    }

    override fun attachView(savedInstanceState: Bundle?) {
        mPresenter.attachView(this)
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when (item.itemId) {
            android.R.id.home -> onBackPressed()
        }
        return true
    }

    override fun getPresenter(): AboutUsPresenter? = mPresenter

    override fun initView() {
        setSupportActionBar(aboutUsToolbar.toolbar)
        supportActionBar!!.setDisplayHomeAsUpEnabled(true)
        supportActionBar!!.setHomeAsUpIndicator(R.mipmap.ic_left_arrow)
    }

    override fun initData() {}

    override fun setListener() {}

    override fun setupAboutUsDescription(aboutUs: AboutUs?) {
        aboutUs?.let {
            tvWeCat.text = it.wechat
            tvKFPhone.text = it.mobile
            tvAboutUs.text = it.about_us
        }
    }

}
